package com.lzy.masshappy.handler;

import com.lzy.masshappy.common.enums.RespCodeEnum;
import com.lzy.masshappy.model.resp.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    public R handleException(Exception e) {
        log.error("GlobalExceptionHandler handleException: {}", e.getMessage());
        return R.fail(RespCodeEnum.FAIL);
    }

}
